package cn.xingzhen.jfield.componet;

import javax.swing.*;
import java.awt.*;

/**
 * @author wenqiang
 * @date 2023/5/6
 * @comment ..
 */
public class XzButton extends JButton {

    public XzButton(String title) {
        super(title);
        initDefault();
        setPreferredSize(new Dimension(XzUIConfigure.DEFAULT_WIDTH_BUTTON, XzUIConfigure.DEFAULT_COMPONENT_HEIGHT));
    }

    public XzButton(String title, int width) {
        super(title);
        setPreferredSize(new Dimension(width, XzUIConfigure.DEFAULT_COMPONENT_HEIGHT));
        initDefault();
    }

    private void initDefault() {
        setBorderPainted(true);
        if(XzUIConfigure.SHOW_BORDER) {
            setBorder(BorderFactory.createLineBorder(XzUIConfigure.BORDER_COLOR));
        } else {
            //setBorder(BorderFactory.createCompoundBorder());
        }
    }

}
